package com.szbmyoubao.app.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.szbmyoubao.app.bean.MenuItem
import com.ellecity06.common.base.BaseAdapter
import com.ellecity06.cwhiskymall.databinding.ItemMineMenuBinding

/**
 * @author zavier
 * @time 2025/3/6 13:59
 * @des
 */
class MineBlockAdapter : BaseAdapter<MenuItem, ItemMineMenuBinding>() {
    override fun inflateBinding(
        layoutInflater: LayoutInflater, parent: ViewGroup, viewType: Int
    ): ItemMineMenuBinding {
        return ItemMineMenuBinding.inflate(layoutInflater, parent, false)
    }

    override fun convert(binding: ItemMineMenuBinding, position: Int, item: MenuItem) {
        binding.ivIcon.setImageResource(item.icon)
        binding.tvLabel.text = item.name
        if (item.message > 0) {
            binding.tvMessageCount.text = "${item.message}"
            binding.tvMessageCount.visibility = View.VISIBLE
        } else {
            binding.tvMessageCount.visibility = View.GONE
        }

    }
}